<!DOCTYPE html>
<html xmlns:th="www.thymeleaf.org">
<head th:replace="admin::head"></head>
<title>用户管理 - 管理员中心 - 双辞动漫-专注二次元动漫的小站</title>
<meta name="keywords" content="用户管理 - 管理员中心">
<meta name="description" content="用户管理 - 管理员中心">
<link rel="stylesheet" type="text/css" href="css/admin_info.css">
<script type="text/javascript" src="/template/conch/asset/js/set/formValidator.js"></script>
<script type="text/javascript" src="/static/js/jquery.imageupload.js"></script>
<script type="text/javascript">
    var maccms={"path":"","mid":"6","url":"www.scdmfun.cn","wapurl":"www.cdmfun.cn","mob_status":"0"};
    var conchtpl={"surl":"/search.html","tipt":"网站公告","tipc":"这里是双辞动漫新站<br><span class='hl-text-conch'>注意事项：</span>1.老站新老站账号不通用<br>老站网址：<span class='hl-text-conch'>dm.scdmfun.cn</span><br>2.如果登录后还是提示未登录请稍等一会再刷新即可<br>动漫闲聊群：<span class='hl-text-conch'>542266218</span>","slink":"https://www.scdmfun.cn/","short":"","api":"0","tok":"","term":"long-term","ver":"3.1"}
</script>
<body id="conch-member">
<!--海螺影视主题  https://www.360mb.net/23977.html-->
<div th:replace="admin::.conch-header"></div>
<div class="conch-header">
    <div class="conch-headwrap conch-hasone conch-hasconch hl-hide-sm">
        <div class="hl-mob-nav">
            <a href="javascript:MAC.GoBack()" class="hl-pull-left left"><i class="iconfont hl-icon-jiantouzuo"></i></a>
            <a href="javascript:void(0)" class="hl-pull-right right"></a>
            <span class="hl-mob-title hl-text-site hl-lc-1">用户管理</span>
        </div>
    </div>
</div>
<div class="conch-content conch-member">
    <div class="conch-ctwrap">
        <div class="hl-ctwrap-item">
            <div class="container">
                <div class="hl-row-box clearfix">
                    <div class="row">
                        <div th:replace="admin::#left"></div>
                        <div id="right" class="hl-right-content hl-col-xs-12 hl-col-sm-70w hl-col-lg-9">
                            <div class="hl-cont-right">
                                <div class="hl-rb-head hl-hidden-xs clearfix">
                                    <h2 class="hl-rb-title">用户管理</h2>
                                </div>
                                <div class="hl-cont-tab">
                                    <div class="hl-rb-head hl-head-page clearfix">
                                        <div class="hl-rb-title hl-site-tabs hl-site-tits hl-text-site">
                                            <a>用户名：</a>
                                            <input type="text" style="position: absolute;top: 68px;border: 0;background: 0 0;line-height: 50px;width: 220px;"
                                                   placeholder="请输入用户名" v-model="ucount"/>
                                            <button class="hl-btn-submit hl-bg-conch" style="width: 120px;height: 43px;display: inline;position: absolute;top: 44px;right: 234px;" @click="query">查询相关用户</button>
                                            <button class="hl-btn-submit hl-bg-conch" style="width: 90px;height: 43px;display: inline;position: absolute;top: 44px;right: 127px;" @click="queryAll">查询所有</button>
                                        </div>
                                    </div>
                                    <div class="hl-cont-list">
                                        <div class="hl-list-wrap">
                                            <form id="fm" name="fm" method="post" action="">
                                                <p style="margin-bottom: revert">
                                                    <span style="width: 70px">序号</span>
                                                    <span style="width: 260px">用户名</span>
                                                    <span style="width: 120px">昵称</span>
                                                    <span style="width: 120px">状态</span></p>
                                                <list v-for="(value,key) in users" :value="value" @del="del"></list>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $("#btn_submit").click(function () {
            var data = $("#fm").serialize();
            $.ajax({
                url: "/index.php/user/info.html",
                type: "post",
                dataType: "json",
                data: data,
                beforeSend: function () {
                    //开启loading
                    //$(".loading_box").css("display","block");
                    $("#btn_submit").css("background", "#fd6a6a").val("loading...");
                },
                success: function (r) {
                    alert(r.msg);
                    if (r.code == 1) {
                        location.href = "/index.php/user/info.html";
                    }
                },
                complete: function () {
                    //结束loading
                    //$(".loading_box").css("display","none");
                    $("#btn_submit").css("background", "#fa4646").val("提交");
                }
            });
        });

    </script>
</div>
<!--海螺影视主题  https://www.360mb.net/23977.html-->
<div th:replace="admin::.conch-footer"></div>
<template id="userlist">
    <p style="margin-bottom: revert">
        <span style="width: 70px">{{value.uid}}</span>
        <span style="width: 260px">{{value.ucount}}</span>
        <span style="width: 120px">{{value.nickname==null?'暂无':value.nickname}}</span>
        <span style="width: 120px">{{value.ustate}}</span>
        <button type="button" class="hl-btn-submit hl-bg-conch" style="width: 100px;position: relative;top: -20px" @click="del(value.uid,value.ustate)" v-text="value.ustate=='正常'?'冻结':'解冻'"></button>
    </p>
</template>
<script type="text/javascript">
    let a=new Vue({
        el: "#right",
        data: {
            ucount: '',
            users:[],
            isAll: false
        },
        methods: {
            query(){
                this.users=[];
                this.isAll=false;
                var url="user/queryByUcount.do";
                var params=new URLSearchParams();
                params.append("ucount",this.ucount);
                axios.post(url,params).then(res=>{
                    var data=res.data;
                    if (data.code==1){
                        this.users=data.data;
                    };
                    alert(data.msg);
                })
            },
            queryAll(){
                this.users=[];
                this.isAll=true;
                var url="queryAllUser.do";
                var params=new URLSearchParams();
                axios.post(url,params).then(res=>{
                    var data=res.data;
                    if (data.code==1){
                        this.users=data.data;
                    };
                    alert(data.msg);
                })
            },
            del(uid,ustate,key){
                var url="freeze.do";
                var params=new URLSearchParams();
                params.append("uid",uid);
                if (ustate=='正常'){
                    params.append("isfreeze",true);
                }else {
                    params.append("isfreeze",false);
                }
                axios.post(url,params).then(res=>{
                    var data=res.data;
                    alert(data.msg);
                    if (data.code==1){
                        if (this.isAll){
                            this.queryAll();
                        }else {
                            this.query();
                        }
                    }
                });
            }
        },
        components: {
            "list":{
                template:'#userlist',
                props: ['value'],
                methods: {
                    del(uid,ustate){
                        this.$emit('del',uid,ustate);
                    }
                }
            }
        }
    })
</script>
</body>
</html>